#include<bits/stdc++.h>
using namespace std;

string s1[100], s2[100];

int main()
{
	int k1, k2;
	k1 = k2 = 0;
	while(cin>>s1[k1] && s1[k1] != "\n")
		k1++;
	cin.get();
	while(cin>>s2[k2] && s2[k2] != "\n")
		k2++;
	string x, y;
	x = y = "";
	
	for(int i = 0;i < k1;i++)
		x += s1[i];
		
	for(int i = 0;i < k2;i++)
		y += s2[i];
		
	transform(x.begin(), x.end(), x.begin(), ::tolower);
	transform(y.begin(), y.end(), y.begin(), ::tolower);
	cout<<x<<endl<<y<<endl;
	if(x == y)
		cout<<"YES";
	else
		cout<<"NO";
    return 0;
}

